package com.qzsoft.zhjd.machine.modules.machinedriver.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qzsoft.zhjd.common.components.BaseServiceComponent;
import com.qzsoft.zhjd.machine.modules.machinedriver.mapper.MachineDriverMapper;
import com.qzsoft.zhjd.machine.modules.machinedriver.entity.MachineDriverEntity;
import com.qzsoft.zhjd.machine.modules.machinedriver.service.MachineDriverService;

/**
 * @ClassName MachineDriverServiceImpl
 * @Description 驾驶员业务实现接口
 * @author linhuawei
 * @since 2021-10-29
 */
@Service
public class MachineDriverServiceImpl extends ServiceImpl<MachineDriverMapper, MachineDriverEntity>
        implements MachineDriverService {

    @Autowired
    private BaseServiceComponent baseServiceComponent;

    @Override
    public IPage<MachineDriverEntity> page(Map<String, Object> params) {
        if (null == params) {
            params = new HashMap<String, Object>();
        }
        IPage<MachineDriverEntity> page = baseServiceComponent.getPage(params, MachineDriverEntity.class);
        QueryWrapper<MachineDriverEntity> queryWrapper = baseServiceComponent.getQueryWrapper(params,
                MachineDriverEntity.class, "name", "phone");
        return baseMapper.selectPage(page, queryWrapper);
    }

    @Override
    public List<MachineDriverEntity> list(Map<String, Object> params) {
        QueryWrapper<MachineDriverEntity> queryWrapper = null;
        if (null != params) {
            queryWrapper = baseServiceComponent.getQueryWrapper(params, MachineDriverEntity.class, "name", "phone");
        }
        return baseMapper.selectList(queryWrapper);
    }

}
